<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_ask.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.trade.ts_category.*" %>	
<%@page import="com.lmpop.frame.util.PageTools" %>
<%
	request.setCharacterEncoding("UTF-8");
	Hashtable ti_ask = new Hashtable();

	
	String req_cust_name="";
	
	String req_title="";
	
	String req_state_code="";
	
	String req_class_attr="";
	

	
	if(request.getParameter("req_cust_name")!=null && !request.getParameter("req_cust_name").equals("")){
		req_cust_name = request.getParameter("req_cust_name");
		ti_ask.put("cust_name",req_cust_name);
	}
	
	if(request.getParameter("req_title")!=null && !request.getParameter("req_title").equals("")){
		req_title = request.getParameter("req_title");
		ti_ask.put("title",req_title);
	}
	
	if(request.getParameter("req_state_code")!=null && !request.getParameter("req_state_code").equals("")){
		req_state_code = request.getParameter("req_state_code");
		ti_ask.put("state_code",req_state_code);
	}
	ti_ask.put("m_state_code","");
	if(request.getParameter("req_class_attr")!=null && !request.getParameter("req_class_attr").equals("")){
		req_class_attr = request.getParameter("req_class_attr");
		ti_ask.put("class_attr",req_class_attr);
	}
	Ti_askInfo ti_askInfo = new Ti_askInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_askInfo.getListByPage(ti_ask,Integer.parseInt(iStart),limit);
	int counter = ti_askInfo.getCountByObj(ti_ask);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?req_class_attr="+req_class_attr+"&req_title="+req_title+"&req_state_code="+req_state_code+"&iStart=",Integer.parseInt(iStart),limit);
	
	Ts_categoryInfo ts_categoryInfo = new Ts_categoryInfo();
	Map catMap  = ts_categoryInfo.getCatClassMap("7");
	String selecttree = ts_categoryInfo.getCategoryTree("000000000000000","7","");
%>
<html>
  <head>
    
    <title>提问审核</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/engine.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/util.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/Ts_categoryInfo.js'></script>   
	<script type="text/javascript" src="/js/commen.js"></script>
	<script type="text/javascript" src="index.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>提问审核</h1>
			</td>
			
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">
	
	<!--
	<table width="100%" align="center" cellpadding="0" cellspacing="0" class="dl_so">
        <tr>
          <td width="9%" align="center"><img src="/program/admin/index/images/ban_01.gif" /></td>
          <td width="91%" align="left">
		  <h4>-----------------</h4>
		  <span>1----------------。</span><br/>
		  <span>2----------------。</span>
		  </td>
        </tr>
      </table>
      <br/>
	  -->
	  
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left" >
				
				
					<input name="req_cust_name" type="hidden" />&nbsp;
		  		
					标题:<input name="req_title" type="text" />&nbsp;
		  		
					&nbsp;
		  		状态:
					<select name="req_state_code">
						<option value="">请选择</option>	
						<option value="a">未审核</option>
						<option value="b">审核未通过</option>
			      </select>
					类型:
				<select name="sort1" id="sort1" onclick="setSecondClass(this.value);" >
							  <option value="">请选择</option>
					  </select>	
						<select name="sort2" id="sort2" onclick="setTherdClass(this.value);">
							  <option value="">请选择</option>
						</select>		
						<select name="sort3" id="sort3">
							  <option value="">请选择</option>
						</select>		
				<input type="hidden" name="req_class_attr" id="req_class_attr" value=""/>			
			  <script type="text/javascript" src="classify.js"></script>
		  		

				<input name="searchInfo" type="button" value="搜索" onclick="return search();"/>	
			</td>
		</tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="updatestate('c')" value="审核通过" class="buttab"/>
				<input type="button" name="delInfo" onclick="updatestate('b')" value="审核不通过" class="buttab"/>
			    <input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>				
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onclick="selectAll()"></th>
			
		  	<th>发布人</th>
		  	
		  	<th>标题</th>
		  	
		  	<th>状态</th>
		  	
		  	<th>类型</th>
		  	
		  	<th>发布日期</th>
		  	
			<th width="10%">审核</th>
	  		<th width="10%">删除</th>
		</tr>
		
		
		<% 
		  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		  			String trade_id="",cust_id="",cust_name="",state="",title="",contents="",state_code="",reply="",class_attr="",reply_num="",user_id="",user_name="",in_date="";
		  			  	if(map.get("trade_id")!=null) trade_id = map.get("trade_id").toString();
						if(map.get("cust_id")!=null) cust_id = map.get("cust_id").toString();
						if(map.get("cust_name")!=null) cust_name = map.get("cust_name").toString();
						if(map.get("title")!=null) title = map.get("title").toString();
						if(map.get("contents")!=null) contents = map.get("contents").toString();
						if(map.get("state_code")!=null) state_code = map.get("state_code").toString();
						if(state_code.equals("a")){
						state="未审核";
						}
						if(state_code.equals("b")){
						state="审核未通过";
						}
						if(state_code.equals("c")){
						state="正常/审核通过";
						}
						if(state_code.equals("d")){
						state="禁用";
						}
						if(map.get("reply")!=null) reply = map.get("reply").toString();
						if(map.get("class_attr")!=null) class_attr = map.get("class_attr").toString();
						
						StringBuffer output =new StringBuffer();
					if(!class_attr.equals(""))
					{
					  String chIds[] =	class_attr.split("\\|");	
					  for(String chId:chIds)
					  {
						 if(catMap!=null)
						 {
							 if(catMap.get(chId)!=null)
							 {
								output.append("<a href='index.jsp?req_class_attr="+chId+"'>"+catMap.get(chId).toString()+"</a> ");                 
							  }                  
						 
						  }                 
					   }		    
					}
						if(map.get("reply_num")!=null) reply_num = map.get("reply_num").toString();
						if(map.get("user_id")!=null) user_id = map.get("user_id").toString();
						if(map.get("user_name")!=null) user_name = map.get("user_name").toString();
						if(map.get("in_date")!=null) in_date = map.get("in_date").toString();
						if(in_date.length()>19)in_date=in_date.substring(0,19);

		  %>
		
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=trade_id %>" /></td>
			
		  	<td><%=cust_name%></td>
		  	
		  	<td><%=title%></td>
		  	
		  	<td><%=state%></td>
		  	
		  	<td><%=output%></td>
		  	
		  	<td><%=in_date%></td>
		  	
			<td width="10%"><a href="updateInfo.jsp?trade_id=<%=trade_id %>"><img src="/program/admin/images/edit.gif" title="修改" /></a></td>
	  		<td width="10%"><a href="javascript:deleteOneInfo('<%=trade_id%>','6084');"><img src="/program/admin/images/delete.gif" title="删除" /></a></a></td>
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo('c')" value="审核通过" class="buttab"/>
				<input type="button" name="delInfo" onclick="delIndexInfo('b')" value="审核不通过" class="buttab"/>
			    <input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			   </td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="state_code" id="state_code" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="6084" />
	  </form>
</body>

</html>
